package eco2automotive.gui;
import javax.swing.*;

/**  
  * Display a message box
  * @version 1.0
  * @autor Fco. Javier Sánchez Esparza
  *
  */ 
public class InforAlert extends JOptionPane{
		String tittle;
		String description;
                int tipo;
                // 0: Warning - 1: Error
  /** 
* Constructor
     * @param tittle 
     * @param desc , the message
     * @param type : 
     * </br> 0 = WARNING_MESSAGE
     * </br> 1 = ERROR_MESSAGE
     * </br> 2 = INFORMATION_MESSAGE
     * </br> 3 = QUESTION_MESSAGE 
    */                
public InforAlert(String tittle, String desc,int type){
			this.tittle=tittle;
			this.description=desc;
                        this.tipo=type;
			}
		
		public void showAlert(){
                    switch(tipo){
                        case 0: {		showMessageDialog(this,this.description,
      this.tittle,JOptionPane.WARNING_MESSAGE);
                            break;}
                        case 1: {		showMessageDialog(this,this.description,
      this.tittle,JOptionPane.ERROR_MESSAGE);
                            break;}
                        case 2:{                       
                                                showMessageDialog(this,this.description,
      this.tittle,JOptionPane.INFORMATION_MESSAGE);
                            break;      
                        }
      case 3:{                       
                                                showMessageDialog(this,this.description,
      this.tittle,JOptionPane.QUESTION_MESSAGE);
                            break;      
                        }                                             
                        default: break;
                            
                    }
	
		}
		
	
	}
